<template>
  <view class="section-header" :class="{ divider: showDivider }">
    <view class="header-left">
      <up-icon v-if="icon" :name="icon" :size="iconSize" :color="iconColor"></up-icon>
      <text class="header-title">{{ title }}</text>
      <view v-if="count !== undefined" class="header-count">{{ count }}</view>
    </view>
    <view class="header-right">
      <slot name="right"></slot>
    </view>
  </view>
</template>

<script setup>
defineProps({
  // 标题
  title: {
    type: String,
    required: true
  },
  // 图标
  icon: {
    type: String,
    default: ''
  },
  // 图标大小
  iconSize: {
    type: [Number, String],
    default: 20
  },
  // 图标颜色
  iconColor: {
    type: String,
    default: 'var(--primary-color)'
  },
  // 计数
  count: {
    type: [Number, String],
    default: undefined
  },
  // 是否显示下方分割线
  showDivider: {
    type: Boolean,
    default: true
  }
});
</script>

<style lang="scss" scoped>
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24rpx 0 12rpx;
  margin-bottom: 16rpx;
  
  &.divider {
    border-bottom: 1rpx solid var(--border-color-split);
  }
  
  .header-left {
    display: flex;
    align-items: center;
    
    .header-title {
      font-size: 28rpx;
      font-weight: 600;
      color: var(--text-primary);
      margin: 0 12rpx;
    }
    
    .header-count {
      font-size: 22rpx;
      color: var(--text-tertiary);
      background-color: var(--bg-layout);
      padding: 2rpx 12rpx;
      border-radius: 20rpx;
    }
  }
  
  .header-right {
    display: flex;
    align-items: center;
  }
}
</style> 